package com.hxx.day9;

/**
 * 阻塞sleep
 */
public class TestDemo3 {

    public static void main(String[] args) {
        Runnable runnable = ()-> {
            for (int index = 0; index < 5; index++) {
                //阻塞
                try {
                    Thread.sleep(1000);
                    System.out.println(Thread.currentThread().getName()+"------>>"+index);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        };
        Thread t = new Thread(runnable);
        t.start();// 启动线程
    }
}


























